package com.hmdp.config;

import com.hmdp.Interceptor.LoginInterceptor;
import com.hmdp.Interceptor.RefreshTokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @BelongsProject: hm-dianping
 * @BelongsPackage: com.hmdp.config
 * @Author: jiangyi
 * @CreateTime: 2025-08-14  11:06
 * @Description: TODO
 * @Version: 1.0
 */
//@Configuration
//public class MvcConfig implements WebMvcConfigurer {
//    @Autowired
//    private StringRedisTemplate stringRedisTemplate; //  关键！让 Spring 把容器里那个已经注入好字段的 Bean 给你
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(new LoginInterceptor()) // 必须使用注入的Bean，而不是new
//                .excludePathPatterns(
//                        "/shop/**",
//                        "/voucher/**",
//                        "/shop-type/**",
//                        "/upload/**",
//                        "/blog/hot",
//                        "/user/code",
//                        "/user/login"
//                ).order(1);
//        registry.addInterceptor(new RefreshTokenInterceptor(stringRedisTemplate)).addPathPatterns("/**").order(0);
//    }
//}
